package com.daiqile.myinterest.utils;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.daiqile.myinterest.R;

/**
 * @author Mr.Bean
 * @date Created on 2017/11/27.
 */

public class HeaderProductLayout extends LinearLayout {
    ImageView mImageView;
    public HeaderProductLayout(Context context) {
        super(context);
        initView(context);
    }

    private void initView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.header_layout,this);
        mImageView = (ImageView) view.findViewById(R.id.header_product_image);
    }

    //view此时与屏幕顶部的距离（Y轴距离）
    public int getDistanceY() {
        int[] location = new int[2];
        mImageView.getLocationOnScreen(location);
        int y = location[1];
        return y;
    }
}
